package zq.cn.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.SlidingDrawer;

public class MainActivity extends AppCompatActivity {
    private SlidingDrawer sd;
    private ImageView imv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        sd = (SlidingDrawer) findViewById(R.id.sd);
        imv = (ImageView) findViewById(R.id.sliding_img);

        sd.setOnDrawerOpenListener(new SlidingDrawer.OnDrawerOpenListener() {
            @Override
            public void onDrawerOpened() {
                imv.setBackgroundResource(R.drawable.b);
            }
        });

        sd.setOnDrawerCloseListener(new SlidingDrawer.OnDrawerCloseListener() {
            @Override
            public void onDrawerClosed() {
                imv.setBackgroundResource(R.drawable.a);
            }
        });
    }
}
